//var userName=null;

Ext.layout.UXCardLayout = Ext.extend(Ext.layout.CardLayout, {
	setActiveItem : function(item) {
		item = this.container.getComponent(item);
		if (this.activeItem != item) {
			if (this.activeItem) {
				this.activeItem.hide();
			}
			if (this.activeItem && !this.activeItem.hidden) {
				return;
			}
			this.activeItem = item;
			item.show();
			this.layout();
		}
	}
});
Ext.UXWizHeader = Ext.extend(Ext.BoxComponent, {
	height : 55,
	region : "north",
	title : "Wizard",
	steps : 0,
	stepText : "<font size='3' style='font-family:Microsoft Yahei'>Step {0} of {1}: {2}</font>",
	autoEl : {
		tag : "div",
		cls : "ext-ux-wiz-Header",
		children : [ {
			tag : "div",
			cls : "ext-ux-wiz-Header-title"
		}, {
			tag : "div",
			children : [ {
				tag : "div",
				cls : "ext-ux-wiz-Header-step"
			}, {
				tag : "div",
				cls : "ext-ux-wiz-Header-stepIndicator-container"
			} ]
		} ]
	},
	titleEl : null,
	stepEl : null,
	imageContainer : null,
	indicators : null,
	stepTemplate : null,
	lastActiveStep : -1,
	updateStep : function(currentStep, title) {
		var html = this.stepTemplate.apply({
			0 : currentStep + 1,
			1 : this.steps,
			2 : title
		});
		this.stepEl.update(html);
		if (this.lastActiveStep != -1) {
			this.indicators[this.lastActiveStep]
					.removeClass("ext-ux-wiz-Header-stepIndicator-active");
		}
		this.indicators[currentStep]
				.addClass("ext-ux-wiz-Header-stepIndicator-active");
		this.lastActiveStep = currentStep;
	},
	onRender : function(ct, position) {
		Ext.UXWizHeader.superclass.onRender.call(this, ct, position);
		this.indicators = [];
		this.stepTemplate = new Ext.Template(this.stepText), this.stepTemplate
				.compile();
		var el = this.el.dom.firstChild;
		var ns = el.nextSibling;
		this.titleEl = new Ext.Element(el);
		this.stepEl = new Ext.Element(ns.firstChild);
		this.imageContainer = new Ext.Element(ns.lastChild);
		this.titleEl.update(this.title);
		var image = null;
		for ( var i = 0, len = this.steps; i < len; i++) {
			image = document.createElement("div");
			image.innerHTML = "&#160;";
			image.className = "ext-ux-wiz-Header-stepIndicator";
			this.indicators[i] = new Ext.Element(image);
			this.imageContainer.appendChild(image);
		}
		
		//获得companyid////////////////////////////
//		Ext.Ajax.request({
//			url : 'showSessionId',
//			success : function(res,opt) {
//				var resjson=Ext.util.JSON.decode(res.responseText);
//				var sessionId=resjson.sessionId;
//				userName=resjson.userName;
//			},
//			failure:function(res,opt){
//			}
//		});
		///////////////////////////////////////////
	}
});
Ext.UXWiz = Ext.extend(Ext.Window, {
	loadMaskConfig : {
		"default" : "Saving..."
	},
	height : 400,
	width : 540,
	closable : true,
	resizable : false,
	modal : true,
	cards : null,
	previousButtonText : "&lt; Previous",
	nextButtonText : "Next &gt;",
	cancelButtonText : "Cancel",
	finishButtonText : "Finish",
	headerConfig : {},
	cardPanelConfig : {},
	previousButton : null,
	nextButton : null,
	cancelButton : null,
	cardPanel : null,
	currentCard : -1,
	headPanel : null,
	cardCount : 0,
	initComponent : function() {
		this.initButtons();
		this.initPanels();
		var title = this.title || this.headerConfig.title;
		title = title || "";
		Ext.apply(this,
				{
					title : title,
					layout : "border",
					cardCount : this.cards.length,
					buttons : [ this.previousButton, this.nextButton,
							this.cancelButton ],
					items : [ this.headPanel, this.cardPanel ]
				});
		this.addEvents("cancel", "finish");
		Ext.UXWiz.superclass.initComponent.call(this);
		this.cardPanel.activeItem = 0;
	},
	getWizardData : function() {
		var formValues = {};
		var cards = this.cards;
		for ( var i = 0, len = cards.length; i < len; i++) {
			if (cards[i].form) {
				formValues[cards[i].id] = cards[i].form.getValues(false);
			} else {
				formValues[cards[i].id] = {};
			}
		}
		return formValues;
	},
	switchDialogState : function(enabled, type) {
		this.showLoadMask(!enabled, type);
		this.previousButton.setDisabled(!enabled);
		this.nextButton.setDisabled(true);
		//this.nextButton.setDisabled(false);
		this.cancelButton.setDisabled(true);
		if (this.closable) {
			var ct = this.tools["close"];
			switch (enabled) {
			case true:
				this.tools["close"].unmask();
				break;
			default:
				this.tools["close"].mask();
				break;
			}
		}
	},
	showLoadMask : function(show, type) {
		if (!type) {
			type = "default";
		}
		if (show) {
			if (this.loadMask == null) {
				this.loadMask = new Ext.LoadMask(this.body);
			}
			this.loadMask.msg = this.loadMaskConfig["type"];
			this.loadMask.show();
		} else {
			if (this.loadMask) {
				this.loadMask.hide();
			}
		}
	},
	initPanelsEvents : function() {
		var cards = this.cards;
		for ( var i = 0, len = cards.length; i < len; i++) {
			cards[i].on("show", this.onCardShow, this);
			cards[i].on("hide", this.onCardHide, this);
			cards[i].on("clientvalidation", this.onClientValidation, this);
		}
	},
	initPanels : function() {
		var cards = this.cards;
		var cardPanelConfig = this.cardPanelConfig;
		Ext.apply(this.headerConfig, {
			steps : cards.length
		});
		this.headPanel = new Ext.UXWizHeader(this.headerConfig);
		Ext.apply(cardPanelConfig, {
			layout : new Ext.layout.UXCardLayout(),
			items : cards
		});
		this.initPanelsEvents();
		Ext.applyIf(cardPanelConfig, {
			region : "center",
			border : false,
			activeItem : 0
		});
		this.cardPanel = new Ext.Panel(cardPanelConfig);
	},
	initButtons : function() {
		this.previousButton = new Ext.Button({
			text : this.previousButtonText,
			disabled : true,
			minWidth : 75,
			handler : this.onPreviousClick,
			scope : this
		});
		this.nextButton = new Ext.Button({
			text : this.nextButtonText,
			minWidth : 75,
			handler : this.onNextClick,
			scope : this
		});
		this.cancelButton = new Ext.Button({
			text : this.cancelButtonText,
			handler : this.onCancelClick,
			scope : this,
			minWidth : 75
		});
	},
	onClientValidation : function(card, isValid) {
		if (!isValid) {
			this.nextButton.setDisabled(true);
		} else {
			this.nextButton.setDisabled(false);
		}
	},
	onCardHide : function(card) {
		if (this.cardPanel.layout.activeItem.id === card.id) {
			this.nextButton.setDisabled(true);
		}
	},
	onCardShow : function(card) {
		var parent = card.ownerCt;
		var items = parent.items;
		for ( var i = 0, len = items.length; i < len; i++) {
			if (items.get(i).id == card.id) {
				break;
			}
		}
		this.currentCard = i;
		this.headPanel.updateStep(i, card.title);
		if (i == len - 1) {
			this.nextButton.setDisabled(false);
			this.nextButton.setText(this.finishButtonText);
			
		}
		 else {
				this.nextButton.setText(this.nextButtonText);
			    if (card.isValid()) {
					this.nextButton.setDisabled(true);
				}
			    if (i == 0) {
					this.previousButton.setDisabled(true);
					this.nextButton.setDisabled(true);//newly added
				} else {
					this.previousButton.setDisabled(false);
				}
			}
	
		
	},
	onCancelClick : function() {
		if (this.fireEvent("cancel", this) !== false) {
			this.close();
		}
	},
	onFinish : function() {
		if (this.fireEvent("finish", this.getWizardData()) !== false) {
			this.close();
		}
	},
	onPreviousClick : function() {
		if (this.currentCard > 0) {
			this.cardPanel.getLayout().setActiveItem(this.currentCard - 1);
		}
	},
	onNextClick : function() {
		if (this.currentCard == this.cardCount - 1) {
			this.onFinish();
		} else {
			this.cardPanel.getLayout().setActiveItem(this.currentCard + 1);
		}
	}
});
Ext.UXWizCard = Ext.extend(Ext.FormPanel, {
	header : false,
	hideMode : "display",
	initComponent : function() {
		this.addEvents("beforecardhide");
		Ext.UXWizCard.superclass.initComponent.call(this);
	},
	isValid : function() {
		if (this.monitorValid) {
			return this.bindHandler();
		}
		return true;
	},
	bindHandler : function() {
		var valid = true;
		this.form.items.each(function(f) {
			if (f.isValid && !f.isValid(true)) {
				valid = false;
				return false;
			}
		});
		if (this.buttons) {
			for ( var i = 0, len = this.buttons.length; i < len; i++) {
				var btn = this.buttons[i];
				if (btn.formBind === true && btn.disabled === valid) {
					btn.setDisabled(!valid);
				}
			}
		}
		this.fireEvent("clientvalidation", this, valid);
	},
	initEvents : function() {
		var old = this.monitorValid;
		this.monitorValid = false;
		Ext.UXWizCard.superclass.initEvents.call(this);
		this.monitorValid = old;
		this.on("beforehide", this.bubbleBeforeHideEvent, this);
		this.on("beforecardhide", this.isValid, this);
		this.on("show", this.onCardShow, this);
		this.on("hide", this.onCardHide, this);
	},
	bubbleBeforeHideEvent : function() {
		var ly = this.ownerCt.layout;
		var activeItem = ly.activeItem;
		if (activeItem && activeItem.id === this.id) {
			return this.fireEvent("beforecardhide", this);
		}
		return true;
	},
	onCardHide : function() {
		if (this.monitorValid) {
			this.stopMonitoring();
		}
	},
	onCardShow : function() {
		if (this.monitorValid) {
			this.startMonitoring();
		}
	}
});

Date.prototype.getElapsed = function(A) {
	return Math.abs((A || new Date()).getTime() - this.getTime())
};


 
//文件信息输入表单
var departmentComboStore = new Ext.data.Store({
	proxy : new Ext.data.HttpProxy({
		url : 'showDepartment',
		method : 'post'
	}),
	reader : new Ext.data.JsonReader({
		root : 'Department',
		totalProperty : 'totalDepartment',
		id : 'id'
	}, [ {
		name : 'cnName'
	}, {
		name : 'enName'
	}, {
		name : 'id'
	}, {
		name : 'parentName'
	} ])
});
//departmentComboStore.load();

var selected_row = -1;


function updateFileInfo(record, store) {
	var fileId = record.get('id');
	var fileName = record.get('fileName');
	var department = record.get('departmentId');
	var project=record.get('project');
	var version = record.get('version');
	var groupId = record.get('groupId');
	
	var type = record.get('type');
	Ext.Ajax.request({
		url : 'updateFileInfo.action?method=updateFileInfo' + '&id=' + fileId
				+ '&fileName=' + fileName + '&department=' + department
				+ '&version=' + encodeURIComponent(version) + '&project='
				+ encodeURIComponent(project) + '&type=' + type,
		success : function(res, opt) {
			if (type==5)
			 epcunitComboStore.load({
				 params : {
						//fileName : dept,
						groupId:groupId,
						version:version
				}
			 });

	         store.each(function(rec) {
				rec.set('state', '已提交');					
			});
		
		},
		failure : function() {
			record.set('state', '提交失败');
		}
	});
}


////文件列表
var fileInfoList = new Ext.grid.GridPanel({
	enableColumnResize : true,
	border : true,
	enableColumnMove : true,
	enableHdMenu : false,
	stripeRows : true, //显示斑马线
	loadMask : true,
	//autoHeight : true,
	autoScroll : true,
	autoWidth : true,
	height:'220',
	tbar : ['名称：',new Ext.form.TextField({
		name : 'modelName',
		id:'modelName',
		//fieldLabel : "模型名称",
		allowBlank : false
	}),{xtype : "tbseparator"},'部门：',
	new Ext.form.ComboBox({
		id : 'department_cmb',
		name : 'department',
		//fieldLabel : '部门',
		width:80,
		allowblank : false,
		emptyText : '请选择',
		mode : 'local',
		triggerAction : 'all',
		valueField : 'id',
		displayField : 'cnName',
		editable : false,
		selectOnFocus : true,
		forceSelection : true,
		store : departmentComboStore,
		listeners : {
			select : function(combo, record, index) {

				var c = Ext.getCmp('department_cmb');
				fileInfoList.updateData(selected_row, c.name, record
						.get('cnName'));
				fileInfoList.updateData(selected_row, 'departmentId',
						record.get('id'));
			}
		}
	}), 'submit_____',{xtype : "tbseparator"}, {
		text : '提交模型信息',
		iconCls : 'db-icn-upload_',
		handler : function() {
			var store = fileInfoList.getStore();
			//检查信息是否完整
			for ( var i = 0; i < store.getCount(); i++) {
				var record = store.getAt(i);
				if (record.get('state') == "未提交"
						&& (record.get('department') == ""
								)) {
					Ext.Msg.alert('文件信息不完整', '请将所有未提交的文件信息补充完整后再次提交！');
					return;
				}
			}
			//提交信息
			var failCount = 0;
			for ( var i = 0; i < store.getCount(); i++) {
				var record = store.getAt(i);
				if (record.get('state') != "未提交") {
					continue;
				}
				updateFileInfo(record, store);
				
			}
			
			wizard.nextButton.setDisabled(false);
		},
		scope : this
	}
	],
	cm : new Ext.grid.ColumnModel([
			new Ext.grid.RowNumberer(),
			{
				header : '文件名',
				width : 100,
				dataIndex : 'fileName',
				sortable : true,
				id : 'fileName'
			},
			{
				header : '项目',
				width : 60,
				dataIndex : 'project',
				sortable : false,
				fixed : true,
			    align : 'center'
				
			},
			{
				header : '部门',
				width : 60,
				dataIndex : 'department',
				sortable : false,
				fixed : true,
				renderer : this.formatIcon,
				align : 'center'
			},
			{
				header : '版本',
				width : 60,
				dataIndex : 'version',
				sortable : false,
				fixed : true,
				align : 'center'
			},
			{
				header : '类型',
				width : 60,
				dataIndex : 'type',
				sortable : false,
				fixed : true,
				align : 'center',
				renderer : function(value, cellmeta, record) {
					var typemap = [ [ '0', '无模型' ], [ '1', '流程模型' ],
							[ '2', '功能模型' ], [ '3', '组织模型' ],
							[ '4', '业务对象模型' ], [ '5', 'epc模型' ],
							[ '6', '权限模型' ], [ '7', '角色模型' ] ];
					return typemap[value][1];
				}
			}, {
				header : '状态',
				width : 80,
				dataIndex : 'state',
				sortable : false,
				fixed : true,
				align : 'center'
			} ]),

	ds : new Ext.data.SimpleStore({
		fields : [ 'id', 'fileName', 'project', 'departmentId', 'department',
				'version', 'type', 'state', 'groupId' ]
	}),

	listeners : {
		cellclick : {
			fn : function(grid, rowIndex, columnIndex, e) {
				//点击记录，在表单中显示记录信息
				selected_row = rowIndex;
				var record = fileInfoList.getStore().getAt(rowIndex);
				Ext.getCmp('modelName').setValue(record.get('fileName'));
				//Ext.getCmp('project_txt').setValue(record.get('project'));
				Ext.getCmp('department_cmb').setValue(
						record.get('departmentId'));
			//	Ext.getCmp('version_txt').setValue(record.get('version'));
			},
			scope : this
		}
	},
	//更新列表中数据
	updateData : function(row, field, value) {
		if (selected_row < 0) {
			return;
		}
		var store = fileInfoList.getStore();
		var record = store.getAt(row);
		record.set(field, value);
	}
});
var epcunitComboStore = new Ext.data.Store({
	proxy : new Ext.data.HttpProxy({
		url : 'showEpcunit.action?method=showEpcunit',
		method : 'post'
	}),
	reader : new Ext.data.JsonReader({
		root : 'epcUnit',
		totalProperty  : 'totalEpcUnit',
		id:'epcunitStore'
	}, [{
		name:'epcUnits'
	},{
		name:'fileId'
	},{
		name:'groupId'
	},{
		name : 'id'
	}, {
		name : 'name'
	},{
		name:'uid'
	},{
		name:'versionId'
	}])
});
//var otherModelStore=new Ext.data.Store({
//	proxy:new Ext.data.HttpProxy({
//		url:'matchOtherModel.action?method=matchOtherModel',
//		method:'post'
//	}),
//	reader:new Ext.data.JsonReader({
//		root:'otherModel',
//		totalProperty:'totalOtherModel',
//		id:''
//	})
//})

EpcMatchRecord=Ext.data.Record.create([
      {name:'epcName'},                                
      {name:'epcUnitName'},
      {name:'epcUnitType'},
      {name:'matchModel'}
   
      ]);
var epcCM = new Ext.grid.ColumnModel([
		    new Ext.grid.RowNumberer(),
		{
			header : 'epc',
			width : 100,
			dataIndex : 'epcName',
			sortable : true,
			id : 'epcName'
		},
		{
			header : 'epc单元',
			width : 120,
			dataIndex : 'epcUnitName',
			sortable : true,
			align : 'epcUnitName'
		},
		{
			header : '单元类型',
			width : 60,
			dataIndex : 'epcUnitType',
			sortable : true,
			align : 'epcUnitType'
		},
		{
			header : '匹配模型',
			width : 120,
			dataIndex : 'matchModel',
			sortable : true,
			align : 'matchModel'
//			renderer : function(value, cellmeta, record) {
//				var typemap = [ [ '0', 'int' ], [ '1', 'float' ],
//						[ '2', 'bool' ], [ '3', 'varchar' ] ];
//				return typemap[value][1];
//			}
		} ]);

var epcMatch = new Ext.grid.GridPanel({
	enableColumnResize : true,
	border : true,
	clicksToEdit : 1,
	enableColumnMove : true,
	enableHdMenu : false,
	stripeRows : true, // 显示斑马线
	loadMask : true,
	//autoHeight : true,
	bodyStyle : 'width:100%;height:100%',
	autoScroll:true,
	autoWidth : true,
	editable : true,
	cm : epcCM,
	ds : new Ext.data.SimpleStore({
		fields : [ 'id', 'name' ]
	}),
	
	tbar:[
	      '选择epc模型：',
	      new Ext.form.ComboBox({
	  		id : 'epcunit_cmb',
	  		name : 'epcunit',
	  		//fieldLabel : '选择epc模型',
	  		allowblank : false,
	  		emptyText : '请选择',
	  		mode : 'local',
	  		triggerAction : 'all',
	  		valueField : 'id',
	  		displayField : 'name',
	  		editable : false,
	  		selectOnFocus : true,
	  		forceSelection : true,
	  	    width:100,
	  		store : epcunitComboStore,
	  		listeners : {
	  			select : function(combo, record, index) {
                    var epcGridStore=epcMatch.getStore();
                    var epcUnitList=record.data.epcUnits;
                    for (var i=0;i<epcUnitList.length;i++){
                    	
                    	if (epcUnitList[i].type=='function'|| epcUnitList[i].type=='event' || epcUnitList[i].type=='participant'){
                    		Ext.Ajax.request({
                    			url : 'showOtherModel.action?method=showOtherModel'
                    				+'&epcUnitType='+epcUnitList[i].type
                    				+'&epcUnitName='+epcUnitList[i].name
                    				+'&epcUnitId='+epcUnitList[i].modelId
                    				+'&epcUnitGroupId='+epcUnitList[i].groupId
                    				+'&epcUnitUid='+epcUnitList[i].uid
                    				+'&version='+epcUnitList[i].versionId,
        						async: false,
                    			success : function(res, opt) {
                    				var obj=Ext.util.JSON.decode(res.responseText);
                			   		var modelName=obj.modelName;
                			   	    var type=obj.epcUnitType;
                			   	    var name=obj.epcUnitName;
                			   		epcGridStore.add(new EpcMatchRecord({epcName:record.data.name,epcUnitName:name,epcUnitType:type,matchModel:modelName}));
                			   	   
                			   		},
                    			failure : function() {
                    				
                    			}
                    		});
                    	}
                    }

	  			}
	  		}
	  	}),
	      '______________|',
	      'epc单元:',	      
	      new Ext.form.TextField({
	    		id:'epcUnitName',
	    		name:'epcUnitName',
	    		width:80,
	    		allowblank:false,
	    		enableKeyEvents:true
	      }),
	      '|',
	      '匹配模型:',	      
	      new Ext.form.ComboBox( {
	    	    id :"matchModel",
	    	    name:'matchModel',
	    	    allowblank:true,
	    	    fieldLabel:'类型',
	    		emptyText: '请选择',
	    		mode: 'local',  
	    		width:100,
	    	    triggerAction: 'all',   
	    	    valueField: 'id',   
	    	    displayField: 'text',   
	    	    editable:false,  
	    	    selectOnFocus : false,  
	    	    forceSelection : false,
	    		store: new Ext.data.SimpleStore({   
	    	        fields: ['id','text'],
	    	        data: [ [ '0', 'int' ], [ '1', 'float' ],
							[ '2', 'bool' ], [ '3', 'varchar' ] ]   
	    	    })
	      }),
	      {
		  		xtype:'button',
		  		iconCls : 'search',
		  		width:60,
		  		text:'添加字段',
		  		handler:function(){
		  			var tablename=tableCombo.getValue();
		  			var columnname=Ext.getCmp('columnname').getValue();
		  			var columntype=Ext.getCmp('columntype').getValue();
		  			if(columnname==null || columnname==''){
		  				Ext.Msg.alert('消息','请填写字段名');
		  				return;
		  			}
		  			if(columntype==null || columntype==''){
		  				Ext.Msg.alert('消息','请选择字段类型');
		  				return;
		  			}
		  			var re=/^[a-zA-Z0-9_]{3,32}$/;
		  			if(!re.test(columnname)){
		  				Ext.Msg.alert('消息','字段名只能由字母数字组成，长度为3-32位。');
		  				return;
		  			}
		  			Ext.Ajax.request({
		  				url: 'addTableColumn.action?method=addTableColumn',	
		  				params:{
		  					tablename:tablename,
		  					columnname:columnname,
		  					type:columntype
		  				},
		  			   	success: function(res,opt){
		  			   		Ext.Msg.alert('消息','添加成功！');
		  			   		Ext.getCmp('columnname').setValue('');
			  				Ext.getCmp('columntype').setValue('');
		  			   		columnStore.load({ params: { tablename: tablename} });
		  			   	},
		  			   	failure: function(){
		  			   		
		  			   	}
		  			});
		  		}
		  }
	],
    listeners : {
	    cellclick : {
		    fn : function(grid, rowIndex, columnIndex, e) {
			//点击记录，在表单中显示记录信息
			    selected_row = rowIndex;
			    var record = epcMatch.getStore().getAt(rowIndex);
			    Ext.getCmp('epcUnitName').setValue(record.get('epcUnitName'));
//			    otherModelStore.load({
//			    	params : {
//						epcUnitType : record.get('type'),
//						epcUnitName:record.get('epcUnitName'),
//						epcUnitId:record.get('modelId')
//						
//						
//					}
//			    })
		
		},
		scope : this
	}
    }
});

var wizard = new Ext.UXWiz({
	title : "模型导入",
	resizable : false,
	layout : 'fit',
	closeAction : 'hide', //这个很重要，为了防止关闭窗口后无法打开
	headerConfig : {
		title : "<font size='3' style='font-family:Microsoft Yahei'>步骤</font>"
	},
	/*cardPanelConfig : {
		defaults : {
			baseCls : "x-small-editor",
			bodyStyle : "padding:40px 15px 5px 20px;background-color:#F6F6F6;",
			border : false
		}
	},*/
	cards : [ new Ext.UXWizCard({
		title : "请输入上传模型的名称",
		bodyStyle : "padding:40px 15px 5px 20px",
		/* monitorValid : true, */
		
		 buttons: [
{  
	            text:'插件上传',  
	            handler:function(){wizard.nextButton.setDisabled(false);wizard.onNextClick();wizard.onNextClick();wizard.onNextClick();}
	        }],
		items : [ {
			border : false,
			bodyStyle : "background:none;"
		}, new Ext.form.TextField({
			name : "modelName",
			id:'groupName',
			fieldLabel : "项目名称",
			width:200,
			allowBlank : false,
			validator:function(text){
				if(Ext.util.Format.trim(text).length==0)
  				  	wizard.nextButton.setDisabled(true);
  			  	else{
  			  		wizard.nextButton.setDisabled(false);  			  		
  			  	}
  			  
  		  }

			

		/*
		 * validator:function
		 * vd(text){
		 * if(this.allowBlank==false &&
		 * Ext.util.Format.trim(text).length==0)
		 * return false; else return
		 * true; }
		 */
		}), new Ext.form.TextArea({
			name : "groupDes",
			id:'groupDes',
			fieldLabel: "项目简介",
			width:200,
			length:200,
		    autoscoll:true
			}) ]
	}), new Ext.UXWizCard({
		title : "<font size='3' style='font-family:Microsoft Yahei'>请上传组织视图模型(后缀名为.org)</font>",
		layout : 'fit',
		// monitorValid : true,
		defaults : {
			labelStyle : "font-size:11px"
		},
		items : [
		/*
		 * { border : false, bodyStyle :
		 * "background:none;padding-bottom:30px;",
		 * html : "Please enter your first- and
		 * your lastname. Only letters,
		 * underscores and hyphens are allowed." },
		 */
		new Ext.TabPanel({
			border : false,
			id : 'zuzhijiegoutabpanel',
			activeTab : 0,
			tabPosition : 'bottom',
			items : [
//			    new Ext.ux.UploadDialog.Dialog(null,{
//			    	border : false,
//					width : 450,
//					height : 300,
//					minWidth : 450,
//					minHeight : 300,
//					plain : true,
//					constrainHeader : true,
//					draggable : true,
//					closable : true,
//					maximizable : false,
//					minimizable : false,
//					resizable : true,
//					autoDestroy : true,
//					closeAction : 'hide',
//					title : '上传文件',
//					cls : 'ext-ux-uploaddialog-dialog',
//					url : 'uploadFiles.action',
//					base_params : {},
//					permitted_extensions : [],
//					reset_on_hide : true,
//					allow_close_on_upload : false,
//					upload_autostart : false
//			    })     
			  {
				id : 'zuzhijiegoutab1',
				title : '文件列表',
				xtype : 'departmentUploadpanel',
				uploadUrl : 'uploadFiles.action',
				filePostName : 'myUpload', // 这里很重要，默认值为'fileData',这里匹配action中的setMyUpload属性
				flashUrl : 'uploaddialog/js/swfupload.swf',
				fileSize : '500 MB',
				height : 300,
				border : false,
				bbar:[ 
                     '上传结果：',new Ext.form.TextArea({
	                 name : 'deptResult',
	                 id:'deptResult',
	                 width:500,
	                 fieldLabel : "上传结果"
                     })
                 ],
				fileTypes : '*.*', // 在这里限制文件类型:'*.jpg,*.png,*.gif'
				fileTypesDescription : '所有文件'
//				postParams : {
//					path : 'files\\' // 上传到服务器的files目录下面
//					
//				}
			} 
			  ]
		}) ]
	}),  new Ext.UXWizCard({
		title : "<font size='3' style='font-family:Microsoft Yahei'>请上传业务对象视图(models文件夹下模型文件)，功能视图(functions,processes文件夹下文件),控制视图(epc文件夹下文件)</font>",
		layout : 'fit',
		// monitorValid : true,
		defaults : {
			labelStyle : "font-size:11px"
		},
		items : [
			/*
			 * { border : false, bodyStyle :
			 * "background:none;padding-bottom:30px;",
			 * html : "Please enter your first- and
			 * your lastname. Only letters,
			 * underscores and hyphens are allowed." },
			 */
			new Ext.TabPanel({
				region : 'center',
				border : false,
				id : 'yewuduixiangtabpanel',
				activeTab : 0,
				tabPosition : 'bottom',
                
				items : [ {
					id : 'yewuduixiangtab1',
					title : '文件列表',
					xtype : 'uploadpanel',
					uploadUrl : 'uploadOtherFiles.action',
					filePostName : 'myUpload', // 这里很重要，默认值为'fileData',这里匹配action中的setMyUpload属性
					flashUrl : 'uploaddialog/js/swfupload.swf',
					fileSize : '500 MB',
					height : 300,
					border : false,
					bbar:[ 
		                     '上传结果：',new Ext.form.TextArea({
			                 name : 'otherResult',
			                 id:'otherResult',
			                 width:500,
			                 fieldLabel : "上传结果"
		                     })
		                 ],
					fileTypes : '*.*', // 在这里限制文件类型:'*.jpg,*.png,*.gif'
					fileTypesDescription : '所有文件',
					postParams : {
						path : 'files\\' // 上传到服务器的files目录下面
						                                  
					}
				} ]
			})
		]
	}),new Ext.UXWizCard({
		title : "<font size='3' style='font-family:Microsoft Yahei'>请上传模型压缩包模型(后缀名为.zip)</font>",
		layout : 'fit',
		// monitorValid : true,
		defaults : {
			labelStyle : "font-size:11px"
		},
		items : [
		/*
		 * { border : false, bodyStyle :
		 * "background:none;padding-bottom:30px;",
		 * html : "Please enter your first- and
		 * your lastname. Only letters,
		 * underscores and hyphens are allowed." },
		 */
		new Ext.TabPanel({
			border : false,
			id : 'ziptabpanel',
			activeTab : 0,
			tabPosition : 'bottom',
			items : [ {
				id : 'ziptab1',
				title : '文件列表',
				xtype : 'zipUploadpanel',
				uploadUrl : 'uploadPackage.action',
				filePostName : 'myUpload', // 这里很重要，默认值为'fileData',这里匹配action中的setMyUpload属性
				flashUrl : 'uploaddialog/js/swfupload.swf',
				fileSize : '500 MB',
				height : 300,
				border : false,
				bbar:[ 
                     '<font size="3" style="font-family:Microsoft Yahei">上传结果：</font>',
                     new Ext.form.TextArea({
	                 name : 'zipResult',
	                 id:'zipResult',
	                 width:430,
	                 fieldLabel : "上传结果"
                     })
                 ],
				fileTypes : '*.*', // 在这里限制文件类型:'*.jpg,*.png,*.gif'
				fileTypesDescription : '所有文件',
				postParams : {
					path : '' // 上传到服务器的files目录下面
					//userName:''
				}
			} ]
		}) ]
	}),new Ext.UXWizCard({
		title : "<font size='3' style='font-family:Microsoft Yahei'>请为模型选择部门</font>",
		//bodyStyle : "padding:40px 15px 5px 20px",
		/* monitorValid : true, */
		items : [
		new Ext.Panel({
			autoScroll : true,
			title : '文件信息',
			id : 'fileInfo-panel',
			autoHeight:true,
			height:'100%',
			layout:'fit',
			items : [  
			fileInfoList ]
		})
	]}),new Ext.UXWizCard({
		title : "<font size='3' style='font-family:Microsoft Yahei'>请关联EPC模型</font>",
		//bodyStyle : "padding:40px 15px 5px 20px",
		layout : 'fit',
		// monitorValid : true,
		defaults : {
			labelStyle : "font-size:11px;font-family:Microsoft Yahei"
		},
		items : [
            new Ext.Panel({
							//autoScroll : true,
							title : '匹配列表',
							id : 'epcMatch-panel',
							layout : 'fit',
							items : [ epcMatch ]
						   
//                            showPage : function() {
//        		          
//        		            epcunitStore.load();
//        	               } 
                          })
 ]
	})

	]
});
wizard.on("finish", function(t, d) {
	//alert(Ext.encode(d));
	Ext.MessageBox.alert('', '感谢您使用本向导！');
	
	return false;
}, wizard);
//wizard.show();